<div class="layui-fluid">


  <div class="layui-row layui-col-space15">
    <!--今/昨日统计-->
    <div class="layui-col-md12">
      <div class="layui-card">
        <div class="layui-card-header">代付订单</div>
        <div class="layui-card-body">
          <div class="layui-carousel layadmin-carousel layadmin-backlog">
            <div>
              <ul class="layui-row layui-col-space10">
                <script type="text/html" template lay-url="/api/statistics/count4dayIncome">
                  <li class="layui-col-md3">
                    <a lay-href="" class="layadmin-backlog-body">
                      <h3>今日代付订单</h3>
                      <p><cite>{{d.data.todayAgentpayData.totalCount}}</cite> 个</p>
                    </a>
                  </li>
                  <li class="layui-col-xs3">
                    <a lay-href="" class="layadmin-backlog-body">
                      <h3>今日代付总额</h3>
                      <p><cite>{{d.data.todayAgentpayData.totalAmount/100}}</cite> 元</p>
                    </a>
                  </li>
                  <li class="layui-col-xs3">
                    <a lay-href="" class="layadmin-backlog-body">
                      <h3>今日商户手续费</h3>
                      <p><cite>{{d.data.todayAgentpayData.totalFee/100}}</cite> 元</p>
                    </a>
                  </li>
                  <li class="layui-col-xs3">
                    <a lay-href="" class="layadmin-backlog-body">
                      <h3>今日通道成本</h3>
                      <p><cite>{{d.data.todayAgentpayData.totalChannelCost/100}}</cite> 元</p>
                    </a>
                  </li>
                  <li class="layui-col-xs3">
                    <a lay-href="" class="layadmin-backlog-body">
                      <h3>昨日代付订单</h3>
                      <p><cite>{{d.data.yesterdayAgentpayData.totalCount}}</cite> 个</p>
                    </a>
                  </li>
                  <li class="layui-col-xs3">
                    <a lay-href="" class="layadmin-backlog-body">
                      <h3>昨日代付总额</h3>
                      <p><cite>{{d.data.yesterdayAgentpayData.totalAmount/100}}</cite> 元</p>
                    </a>
                  </li>
                  <li class="layui-col-xs3">
                    <a lay-href="" class="layadmin-backlog-body">
                      <h3>昨日商户手续费</h3>
                      <p><cite>{{d.data.yesterdayAgentpayData.totalFee/100}}</cite> 元</p>
                    </a>
                  </li>
                  <li class="layui-col-xs3">
                    <a lay-href="" class="layadmin-backlog-body">
                      <h3>昨日通道成本</h3>
                      <p><cite>{{d.data.yesterdayAgentpayData.totalChannelCost/100}}</cite> 元</p>
                    </a>
                  </li>
                  <li class="layui-col-xs3">
                    <a lay-href="" class="layadmin-backlog-body">
                      <h3>当月代付订单</h3>
                      <p><cite>{{d.data.monthAgentpayData.totalCount}}</cite> 个</p>
                    </a>
                  </li>
                  <li class="layui-col-xs3">
                    <a lay-href="" class="layadmin-backlog-body">
                      <h3>当月代付总额</h3>
                      <p><cite>{{d.data.monthAgentpayData.totalAmount/100}}</cite> 元</p>
                    </a>
                  </li>
                  <li class="layui-col-xs3">
                    <a lay-href="" class="layadmin-backlog-body">
                      <h3>当月商户手续费</h3>
                      <p><cite>{{d.data.monthAgentpayData.totalFee/100}}</cite> 元</p>
                    </a>
                  </li>
                  <li class="layui-col-xs3">
                    <a lay-href="" class="layadmin-backlog-body">
                      <h3>当月通道成本</h3>
                      <p><cite>{{d.data.monthAgentpayData.totalChannelCost/100}}</cite> 元</p>
                    </a>
                  </li>
                </script>
              </ul>
            </div>
          </div>
        </div>
      </div>
    </div>
    <!--商户统计-->
    <div class="layui-col-md12">
      <div class="layui-card">
        <div class="layui-card-header">商户</div>
        <div class="layui-card-body">
          <div class="layui-carousel layadmin-carousel layadmin-backlog">
            <div carousel-item>
              <ul class="layui-row layui-col-space10">
                <script type="text/html" template lay-url="/api/statistics/count4mch">
                  <li class="layui-col-xs3">
                    <a lay-href="" class="layadmin-backlog-body">
                      <h3>总数</h3>
                      <p><cite>{{d.data.mchObj.totalCount}}</cite> 个</p>
                    </a>
                  </li>
                  <li class="layui-col-xs3">
                    <a lay-href="" class="layadmin-backlog-body">
                      <h3>代付余额</h3>
                      <p><cite>{{d.data.mchObj.totalAgentpayBalance/100}}</cite> 元</p>
                    </a>
                  </li>
                  <li class="layui-col-xs3">
                    <a lay-href="" class="layadmin-backlog-body">
                      <h3>代付不可用余额</h3>
                      <p><cite>{{d.data.mchObj.totalUnAgentpayBalance/100}}</cite> 元</p>
                    </a>
                  </li>
                </script>
              </ul>
            </div>
          </div>
        </div>
      </div>
    </div>

  </div>
</div>

<script>
  layui.use('console', layui.factory('console'));
</script>
<script>
    layui.use('console', layui.factory('console'));
</script>
<script>
    layui.use(['admin', 'echarts'], function(){
        var $ = layui.$
            ,admin = layui.admin
            ,element = layui.element
            ,echarts = layui.echarts;

        var myChart = echarts.init(document.getElementById('payOrderAcount'),layui.echartsTheme);

        admin.req({
            type: 'post',
            url: layui.setter.baseUrl + '/statistics/orderDayAmount',
            error: function(err) {
                layer.alert(err);
            },
            success: function(res) {
                if(res.code == 0) {
                    // 指定图表的配置项和数据
                    myChart.setOption({
                        tooltip : { //提示框
                            trigger: 'axis',
                            formatter: "{b}<br>交易金额：{c}"
                        },
                        xAxis: {
                            type: 'category',
                            data: [res.data[6], res.data[5], res.data[4], res.data[3], res.data[2], res.data[1], res.data[0]]
                        },
                        yAxis: {type: 'value'},
                        series: [{
                            type: 'line',
                            data: [
                                res.data[13]==null ? 0 : res.data[13].totalAmount/100,
                                res.data[12]==null ? 0 : res.data[12].totalAmount/100,
                                res.data[11]==null ? 0 : res.data[11].totalAmount/100,
                                res.data[10]==null ? 0 : res.data[10].totalAmount/100,
                                res.data[9]==null ? 0 : res.data[9].totalAmount/100,
                                res.data[8]==null ? 0 : res.data[8].totalAmount/100,
                                res.data[7]==null ? 0 : res.data[7].totalAmount/100,
                            ]
                        }]
                    });
                }
            }
        });
        //根据窗口的大小变动图表 --- 重点
        window.onresize = function(){
            myChart.resize();
        }
    });
</script>